﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VentaElectrodomesticos.Contrato;
using System.Data.SqlClient;

namespace VentaElectrodomesticos.Datos
{
    public class StockDAO : BaseDAO<Stock>
    {
        public int? getLastStock(int producto_id, int sucursal_id)
        {
            String sql = @"SELECT cantidad FROM " + Config.tableSpace + " stocks "
                         + "WHERE producto_id = '" + producto_id.ToString() + "' " 
                         + "AND sucursal_id = '" + sucursal_id.ToString() + "' ";
            return this.executeEscalar(sql);
        }

        public override bool save(Stock entity)
        {
            return this.insert(entity);
        }
    }
}
